<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

<ui:define name="head">
    <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
    <script type="text/javascript" language="javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
                else
                    event.srcElement.click();
            }
        }
        function exportBtnOnClick() {
            document.getElementsByName('exportLink').click();
        }
    </script>
    <style type="text/css">
        .cancel {
            color: #ff0000;
        }

    </style>
</ui:define>
<ui:define name="content">
<div style="margin:5px;">
<h:form id="form" enctype="multipart/form-data">
<p:growl id="msgs" showDetail="true"/>
<p:focus for="id"/>
<p:panel id="ppCondition" style="width: 100%">
    <h:panelGrid columns="2" style="width: 100%;">
        <h:panelGrid id="pgCust" widgetVar="WvCust" columns="4" style="text-align: right;">
            <h:outputLabel value="纳税人识别号:" for="id" style="font-weight: bold;"/>
            <p:inputText id="id" value="#{thAssetAction.queryCondition.taxerID}"/>

            <h:outputLabel value="纳税人名称:" for="name" style="font-weight: bold;margin-left: 100px;"/>
            <p:inputText id="name" value="#{thAssetAction.queryCondition.taxerName}"/>

            <h:outputLabel value="起始日期:" for="startDate" style="font-weight: bold;"/>
            <p:inputText id="startDate" value="#{thAssetAction.queryCondition.dateStart}"
                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>

            <h:outputLabel value="截至日期:" for="endDate" style="font-weight: bold;"/>
            <p:inputText id="endDate" value="#{thAssetAction.queryCondition.dateEnd}"
                         onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/>

            <h:outputLabel value="所属税务机关:" for="taxOrgan" style="font-weight: bold;"/>
            <p:inputText id="taxOrgan" value="#{thAssetAction.queryCondition.taxAuthority}"/>

            <h:outputLabel value="主管税务管员:" for="taxManager" style="font-weight: bold;"/>
            <p:inputText id="taxManager" value="#{thAssetAction.queryCondition.taxManager}"/>

            <h:outputLabel value="房产类型:" for="houseType" style="font-weight: bold;"/>
            <p:selectOneMenu id="houseType" value="#{thAssetAction.queryCondition.houseType}"
                             style="width: 145px;">
                <f:selectItem itemLabel="" itemValue=""/>
                <f:selectItem itemLabel="土地" itemValue="0001"/>
                <f:selectItem itemLabel="房屋" itemValue="0002"/>
                <f:selectItem itemLabel="其它" itemValue="0003"/>
            </p:selectOneMenu>

            <h:outputLabel value="房产性质:" for="houseNature" style="font-weight: bold;"/>
            <p:selectOneMenu id="houseNature" value="#{thAssetAction.queryCondition.houseNature}"
                             style="width: 145px;">
                <f:selectItem itemLabel="" itemValue=""/>
                <f:selectItem itemLabel="高层住宅" itemValue="0010"/>
                <f:selectItem itemLabel="商业网点" itemValue="0011"/>
                <f:selectItem itemLabel="商务" itemValue="0012"/>
                <f:selectItem itemLabel="别墅" itemValue="0013"/>
                <f:selectItem itemLabel="公寓" itemValue="0014"/>
                <f:selectItem itemLabel="普通住宅" itemValue="0015"/>
                <f:selectItem itemLabel="经济适用房" itemValue="0016"/>
                <f:selectItem itemLabel="拆迁住房" itemValue="0017"/>
                <f:selectItem itemLabel="单位集资" itemValue="0018"/>
                <f:selectItem itemLabel="商住两用房" itemValue="0019"/>
                <f:selectItem itemLabel="地下室" itemValue="0020"/>
                <f:selectItem itemLabel="阁楼" itemValue="0021"/>
                <f:selectItem itemLabel="车库" itemValue="0022"/>
                <f:selectItem itemLabel="车位" itemValue="0023"/>
                <f:selectItem itemLabel="其它" itemValue="0099"/>
            </p:selectOneMenu>

        </h:panelGrid>
        <h:panelGrid style="width:10%">
            <p:commandButton id="qryBtn" value="查  询" actionListener="#{thAssetAction.query()}"
                             style="font-size: 14px;width: 80px;" update="tabSum,msgs">
            </p:commandButton>
            <p:commandButton id="resetBtn" type="reset" value="重 置"
                             style="font-size: 14px;width: 80px;">
            </p:commandButton>
        </h:panelGrid>
    </h:panelGrid>
</p:panel>

<p:ajaxStatus style="width:16px;height:16px;">
    <f:facet name="start">
        <h:graphicImage value="/images/ajaxloading.gif"/>
    </f:facet>
    <f:facet name="complete">
        <h:outputText value=""/>
    </f:facet>
</p:ajaxStatus>
<p:dataTable id="tabSum" style="width:100%;"
             value="#{thAssetAction.realPropertyList}"
             var="record"
             rowKey="#{record.pkid}"
             selectionMode="single"
             selection="#{thAssetAction.realPropertySelected}"
             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
              {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
             paginator="true"
             paginatorPosition="bottom"
             rows="15"
             rowsPerPageTemplate="100,50,30,15,5"
             emptyMessage="数据记录为空..."
        >
    <p:ajax event="rowSelect" listener="#{thAssetAction.updateAssetInfo()}" update=":form:tabDetail"/>

    <p:column style="text-align:center" sortBy="#{record.NSRSBH}">
        <f:facet name="header">
            <h:outputText value="纳税人识别号"/>
        </f:facet>
        <h:outputText value="#{record.NSRSBH}"/>
    </p:column>

    <p:column style="text-align:center" filterBy="#{record.NSRMC}" filterMatchMode="contains">
        <f:facet name="header">
            <h:outputText value="纳税人名称"/>
        </f:facet>
        <h:outputText value="#{record.NSRMC}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{record.ASSETCLASS}">
        <f:facet name="header">
            <h:outputText value="房产类型"/>
        </f:facet>
        <h:outputText value="#{record.ASSETCLASS}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{record.ASSETCLASS}">
        <f:facet name="header">
            <h:outputText value="房产性质"/>
        </f:facet>
        <h:outputText value="#{record.ASSETCLASS}"/>
    </p:column>

    <p:column style="text-align:center;width: 55px;" sortBy="#{record.COUNT}">
        <f:facet name="header">
            <h:outputText value="数量"/>
        </f:facet>
        <h:outputText value="#{record.COUNT}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{record.AREA}">
        <f:facet name="header">
            <h:outputText value="面积"/>
        </f:facet>
        <h:outputText value="#{record.AREA}"/>
    </p:column>

    <p:column style="text-align:center" filterBy="#{record.taxAuthority}" filterMatchMode="contains">
        <f:facet name="header">
            <h:outputText value="税务机关"/>
        </f:facet>
        <h:outputText value="#{record.taxAuthority}"/>
        <f:facet name="footer">
            <h:outputText value="笔数：#{fn:length(thAssetAction.realPropertyList)}"/>
        </f:facet>
    </p:column>

    <p:column style="text-align:center" filterBy="#{record.taxerManager}" filterMatchMode="contains">
        <f:facet name="header">
            <h:outputText value="税管员"/>
        </f:facet>
        <h:outputText value="#{record.taxerManager}"/>
        <f:facet name="footer">
            <h:commandLink>
                <h:outputText value="[导出数据]"/>
                <p:dataExporter type="xls" target="tabSum" fileName="fdchz"/>
            </h:commandLink>
        </f:facet>
    </p:column>


</p:dataTable>
<p:separator/>
<p:dataTable id="tabDetail" style="width:100%;"
             value="#{thAssetAction.thAssetList}"
             var="thAsset"
             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks}
              {NextPageLink} {LastPageLink} {RowsPerPageDropdown} "
             paginator="true"
             paginatorPosition="bottom"
             rows="15"
             rowsPerPageTemplate="100,50,30,15"
             emptyMessage="数据记录为空..."
             rowStyleClass="#{thAssetAction.cancelled(thAsset.assetId) ? 'cancel' : ''}">
    <f:facet name="header">
        <h:outputText value="房屋详细信息"/>
    </f:facet>

    <p:column style="text-align:center" sortBy="#{thAsset.assetId}">
        <f:facet name="header">
            <h:outputText value="房产编号"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetId}"/>
    </p:column>

    <p:column style="text-align:center">
        <f:facet name="header">
            <h:outputText value="类型"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetClass}"/>
    </p:column>

    <p:column style="text-align:center">
        <f:facet name="header">
            <h:outputText value="性质"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetType}"/>
    </p:column>

    <p:column style="text-align:center" filterBy="#{thAsset.assetCost}" filterMatchMode="contains">
        <f:facet name="header">
            <h:outputText value="核算项目"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetCost}"/>
    </p:column>

    <p:column style="text-align:center" filterBy="#{thAsset.assetProject}" filterMatchMode="contains">
        <f:facet name="header">
            <h:outputText value="项目名称"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetProject}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{thAsset.assetAddress}">
        <f:facet name="header">
            <h:outputText value="房产地址"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetAddress}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{thAsset.assetBuilding}">
        <f:facet name="header">
            <h:outputText value="楼座号"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetBuilding}"/>
    </p:column>

    <p:column style="text-align:center" sortBy="#{thAsset.assetCell}">
        <f:facet name="header">
            <h:outputText value="单元"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetCell}"/>
    </p:column>
    <p:column style="text-align:center" sortBy="#{thAsset.assetStory}">
        <f:facet name="header">
            <h:outputText value="楼层"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetStory}"/>
    </p:column>
    <p:column style="text-align:center" sortBy="#{thAsset.assetRoom}">
        <f:facet name="header">
            <h:outputText value="房号"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetRoom}"/>
    </p:column>
    <p:column style="text-align:center">
        <f:facet name="header">
            <h:outputText value="结构"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetMakeup}"/>
    </p:column>
    <p:column style="text-align:center" sortBy="#{thAsset.assetKind}">
        <f:facet name="header">
            <h:outputText value="房型"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetKind}"/>
    </p:column>
    <p:column style="text-align:center">
        <f:facet name="header">
            <h:outputText value="朝向"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetOrient}"/>
    </p:column>
    <p:column style="text-align:center" sortBy="#{thAsset.assetArea}">
        <f:facet name="header">
            <h:outputText value="面积"/>
        </f:facet>
        <h:outputText value="#{thAsset.assetArea}"/>
    </p:column>
    <p:column style="text-align:center" sortBy="#{thAsset.inputDate}">
        <f:facet name="header">
            <h:outputText value="录入日期"/>
        </f:facet>
        <h:outputText value="#{thAsset.inputDate}">
            <f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8" locale="cn"></f:convertDateTime>
        </h:outputText>
        <f:facet name="footer">
            <h:outputText value="笔数：#{fn:length(thAssetAction.thAssetList)}"/>
        </f:facet>
    </p:column>
    <p:column style="text-align:center">
        <f:facet name="header">
            <h:outputText value="备注"/>
        </f:facet>
        <h:outputText value="#{thAssetAction.cancelled(thAsset.assetId) ? '[已作废]' : ''}#{thAsset.assetNotes}"/>
        <f:facet name="footer">
            <h:commandLink>
                <h:outputText value="[导出数据]"/>
                <p:dataExporter type="xls" target="tabDetail" fileName="fdcxx"/>
            </h:commandLink>
        </f:facet>
    </p:column>
</p:dataTable>
</h:form>
</div>
</ui:define>
</ui:composition>